Class MyDurationComparator


  • public class MyDurationComparator
    extends MyTrackComparator
    This class represents the concept of comparison of two track by title.
    Version:
    234
    Author:
    TeM, JS
    Stage:
    ES04
    Introduced in:
    ExerciseSheet04
    Programming problem category:
    concrete subclass
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(Track t1, Track t2)
      Compares two tracks by duration.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MyDurationComparator

        public MyDurationComparator()
    • Method Detail

      • compare

        public int compare​(Track t1,
                           Track t2)
        Compares two tracks by duration.

        This comparator assumes non-null arguments.

        Specified by:
        compare in class MyTrackComparator
        Parameters:
        t1 - the one track to compare
        t2 - the other track to which t1 is to be compared
        Returns:
        a measure of the distance between t1 and t2 in the sense of the comparator
        Programming problem aspect:
        concrete method implementation